package com.googlecode.cswish.model;

import java.util.Map;
import java.util.Set;

public class PageElementsTextModel extends PageElements {

	private PageElements pageElements;
	
	public PageElementsTextModel(PageElements pageElements) {
		this.pageElements = pageElements;
	}

	public String getId() {
		return pageElements.getId();
	}

	public void setId(String id) {
		pageElements.setId(id);
	}

	public String getName() {
		return pageElements.getName();
	}

	public void setName(String name) {
		pageElements.setName(name);
	}

	public String getLabel() {
		return pageElements.getLabel();
	}

	public void setLabel(String label) {
		pageElements.setLabel(label);
	}

	public void addElement(PageElement childElement) {
		pageElements.addElement(childElement);
	}

	public String getClazz() {
		return pageElements.getClazz();
	}

	public void setClazz(String clazz) {
		pageElements.setClazz(clazz);
	}

	public Boolean getRequired() {
		return pageElements.getRequired();
	}

	public void setRequired(Boolean required) {
		pageElements.setRequired(required);
	}

	public Object getValue() {
		return pageElements.getValue();
	}

	public void setValue(Object value) {
		pageElements.setValue(value);
	}

	public void setTextModel(Boolean textModel) {
		pageElements.setTextModel(textModel);
	}

	public Boolean getTextModel() {
		return Boolean.TRUE;
	}

	public Integer getLength() {
		return pageElements.getLength();
	}

	public void setLength(Integer length) {
		pageElements.setLength(length);
	}

	@Override
	public PageElement addElement(String type, String name, String label, boolean required, boolean textModel, int width, boolean show) {
		PageElement ps = pageElements.addElement(type, name, label, required, textModel, width, show);
		return new PageElementTextModel(ps);
	}

	public Integer getColspan() {
		return pageElements.getColspan();
	}

	public void setColspan(Integer colspan) {
		pageElements.setColspan(colspan);
	}

	public Boolean getHidden() {
		return pageElements.getHidden();
	}

	public void setHidden(Boolean hidden) {
		pageElements.setHidden(hidden);
	}

	public String getType() {
		return pageElements.getType();
	}

	public void setType(String type) {
		pageElements.setType(type);
	}

	public Map<String, Object> getExtraParams() {
		return pageElements.getExtraParams();
	}

	public PageElements addElements(String type, String name) {
		PageElements ps = pageElements.addElements(type, name);
		return new PageElementsTextModel(ps);
	}

	public void setExtraParams(Map<String, Object> extraParams) {
		pageElements.setExtraParams(extraParams);
	}

	public void addExtraParams(String name, Object value) {
		pageElements.addExtraParams(name, value);
	}

	public void removeElement(PageElement childElement) {
		pageElements.removeElement(childElement);
	}

	public PageElement removeElement(String name) {
		PageElement ps = pageElements.removeElement(name);
		return new PageElementTextModel(ps);
	}

	public void removeExtraParams(String name) {
		pageElements.removeExtraParams(name);
	}

	public PageElement getParent() {
		PageElement ps = pageElements.getParent();
		return new PageElementTextModel(ps);
	}

	public void setParent(PageElement parent) {
		pageElements.setParent(parent);
	}

	public int hashCode() {
		return pageElements.hashCode();
	}

	public PageElement getElement(String childElementName, boolean showWarning) {
		PageElement element = pageElements.getElement(childElementName, showWarning);
		if (element != null) {
			if (element instanceof PageElements) {
				element = new PageElementsTextModel((PageElements) element);
			} else {
				element = new PageElementTextModel(element);
			}
		}
		return element;
	}

	public boolean equals(Object another) {
		return pageElements.equals(another);
	}

	public void cloneTo(PageElement cloned) {
		pageElements.cloneTo(cloned);
	}

	public PageElement safeElement(String name) {
		PageElement ps = pageElements.safeElement(name);
		return new PageElementTextModel(ps);
	}

	public PageElement getElement(String name) {
		PageElement element = pageElements.getElement(name);
		if (element != null) {
			if (element instanceof PageElements) {
				element = new PageElementsTextModel((PageElements) element);
			} else {
				element = new PageElementTextModel(element);
			}
		}
		return element;
	}

	public PageElement findElementByType(String type) {
		PageElement ps = pageElements.findElementByType(type);
		return new PageElementTextModel(ps);
	}

	public void merge(PageElement another) {
		pageElements.merge(another);
	}

	public Map<String, PageElement> getAllElements() {
		return pageElements.getAllElements();
	}

	public Set<String> getEnableFields(String[] additionFields) {
		return pageElements.getEnableFields(additionFields);
	}

	public Set<String> getEnableFields(boolean includeTextModelField, boolean useExactPath, String[] additionFields) {
		return pageElements.getEnableFields(includeTextModelField, useExactPath, additionFields);
	}

	@Override
	public PageElements clone() {
		return pageElements.clone();
	}

	public void cloneTo(PageElements cloned) {
		pageElements.cloneTo(cloned);
	}

	public void setElementId(String name, String id) {
		pageElements.setElementId(name, id);
	}

	public void setElementLength(String name, int length) {
		pageElements.setElementLength(name, length);
	}

	public void setElementClazz(String name, String clazz) {
		pageElements.setElementClazz(name, clazz);
	}

	public void setElementVisible(String name, boolean visible) {
		pageElements.setElementVisible(name, visible);
	}

	public void setElementRequired(String name, boolean required) {
		pageElements.setElementRequired(name, required);
	}

	public void setElementReadOnly(String name, boolean readOnly) {
		pageElements.setElementReadOnly(name, readOnly);
	}

	public void setElementColspan(String name, int colspan) {
		pageElements.setElementColspan(name, colspan);
	}

	public void setGridAllowDblClick(String grid, boolean allow) {
		pageElements.setGridAllowDblClick(grid, allow);
	}

	public String toString() {
		return pageElements.toString();
	}

	public PageElements reset() {
		return pageElements.reset();
	}
}
